<?php

/**
 * Формы обратной связи
 */
class FeedbackForm extends Zend_Form {

    /**
     * Форма настроек формы обратной связи
     *
     * @param int $sid #ID секции
     * @return FeedbackForm
     */
    public function Form($sid) {

        $t = Zend_Registry::get('Zend_Locale');
        $this->setDefaultTranslator($t);
        $this->setName('feedback');
        $model = new FormsModel();
        $form = new Zend_Form_Element_Select('fid');

        $array = $model->getFormsList();
        $empty = array(0 => $t->_('Undefined'));
        $form->addMultiOptions($empty + $array)
                ->setLabel('Form')
                ->addFilter('StripTags')
                ->addFilter('StringTrim')
                ->addValidator('NotEmpty')
                ->setRequired();

        $email = new Zend_Form_Element_Text('email');
        $email->setLabel('E-mail')
                ->addFilter('StripTags')
                ->addFilter('StringTrim')
                ->addValidator('NotEmpty')
                ->setRequired();

        $title = new Zend_Form_Element_Text('title');
        $title->setLabel('E-mail title')
                ->addFilter('StripTags')
                ->addFilter('StringTrim')
                ->addValidator('NotEmpty')
                ->setRequired();
        
        $model = new PageModel();
        $array = $model->getPagesList();
        $redirect = new Zend_Form_Element_Select('redirect');
        $redirect->addMultiOptions($empty + $array)
                ->setLabel('Redirect')
                ->addFilter('StripTags')
                ->addFilter('StringTrim')
                ->addValidator('NotEmpty');    

        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setLabel('Save');
        $submit->setAttrib('id', 'submitbutton');
        $this->addElements(array($form, $email, $title, $redirect, $submit));
        $this->setAction(ADMIN_URL . '/pages/modify/id/' . $sid);
        /*
          $decorator = new Forms_Decorator_Default();
          $this->setElementDecorators(array($decorator));
          $this->setDecorators(array($decorator,$this->getDecorators()));
         */
        return $this;
    }

}